package com.wang.hellohibernate.models;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

@Entity
@Table(name = "Credentials")
public class Credential implements Serializable {

	private static final long serialVersionUID = 3910638982320906551L;

	@Id
	@GeneratedValue
	@Column(name = "id", unique=true)
	Integer id;

	@Column(name = "personId")
	private int personId;

	@Column(name = "enabled")
	private boolean enabled;

	@Column(name = "username", unique=true)
	private String username;

	@Column(name = "password")
	private String password;

	@Column(name = "createDate")
	private Date createdDate;
	
	public Credential() {
	}

	public Credential(int id, String username, String password, Date createdDate, int personId, boolean enabled) {
		this.id = id;
		this.username = username;
		this.password = password;
		this.createdDate = createdDate;
		this.personId = personId;
		this.enabled = enabled;
	}

	
	@XmlAttribute
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}

	
	@XmlElement(nillable=true)
	public int getPersonId() {
		return personId;
	}
	public void setPersonId(int personId) {
		this.personId = personId;
	}

	@XmlElement(nillable=true)
	public boolean isEnabled() {
		return enabled;
	}
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}


	@XmlElement(nillable=true)
	public String getUsername() {
		return this.username;
	}
	public void setUsername(String username) {
		this.username = username;
	}

	@XmlElement(nillable=true)
	public String getPassword() {
		return this.password;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	@XmlElement(nillable=true)
	public Date getCreatedDate() {
		return this.createdDate;
	}
	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
}
